/**************************************************************************
 *         Copyright(c) 2007 by Sunplus mMedia  Technology Co., Ltd.       *
 *                                                                         *
 *  This software is copyrighted by and is the property of Sunplus mMedia  *
 *  Technology Co., Ltd. All rights are reserved by Sunplus mMedia Techno- *
 *  logy Co., Ltd. This software may only be used in accordance with the   *
 *  corresponding license agreement. Any unauthorized use, duplication,    *
 *  distribution, or disclosure of this software is expressly forbidden.   *
 *                                                                         *
 *  This Copyright notice "M U S T" not be removed or modified without     *
 *  prior written consent of Sunplus mMedia Technology  Co., Ltd.          *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd. reserves the right to modify this  *
 *  software without notice.                                               *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd.                                    *
 *  19-1, Innovation First Road, Science-Based Industrial Park,            *
 *  Hsin-Chu, Taiwan, R.O.C.                                               *
 *                                                                         *
 **************************************************************************/
//-----------------------------------------------------------------------------
// Header file
//-----------------------------------------------------------------------------
#ifndef __HAL_H__
#define __HAL_H__

#include "general.h"
#include "device.h"
#include "hal_gpio.h"

//-----------------------------------------------------------------------------
// Data type
//-----------------------------------------------------------------------------
// date
struct DATESTC
{
  UINT8 Year;
  UINT8 Month;
  UINT8 Day;
  UINT8 Hour;
  UINT8 Minute;
  UINT8 Second;
};

//------------------------------------------------------------------------------
//Constant
//------------------------------------------------------------------------------
#define HALK_SUCCESS                     0x00
#define HALK_ERROR_GENERAL               0x01
#define HALK_ERROR_PARAMETER             0x02

#define HALK_CPUInternal                 0x01   // 0 is for external ICE
                                               // 1 is for internal 8051
#define HALK_CPUP1                       0x01   // 0 is for low byte address
                                               // 1 is for 8051 GPIO P1
#define HALK_P1OE                        0xff
#define HALK_P3OE                        0x3e   // P3o is input for RXD

/* DMA */
#define	DMA_PATH_DRAM	0
#define	DMA_PATH_SDRAM	1	//CPU 4K SRAM (0x1000 ~ 0x1FFF)
#define	DMA_PATH_FLASH	2
#define	DMA_PATH_AUDIO	3
#define	DMA_PATH_USB	4
#define	DMA_PATH_PORT	5	//5: DMA data port (0x2300)
/*#define K_Q50                         0x00 //ada@0225
#define K_Q70                           0x01
#define HALK_Q80                         0x02
#define HALK_Q85                         0x03
#define HALK_Q88                         0x04
#define HALK_Q90                         0x05
#define HALK_Q92                         0x06
#define HALK_Q95                         0x07
#define HALK_Q1                          0xff*/

#define HALK_DateWhite                                   0x00
#define HALK_DateYellow                                  0x01
#define HALK_DateCyan                                    0x02
#define HALK_DateGreen                                   0x03
#define HALK_DateMagenta                                 0x04
#define HALK_DateRed                                     0x05
#define HALK_DateBlue                                    0x06
#define HALK_DateBlack                                   0x07

//GLOBAL
#define PPG struct PGSTC *
#define PDATE struct DATESTC *

// for test flash only
#ifdef  TestModeEn
#define HALK_FMactType   0x03       // 0:GPIOs 1:NAND 2:SMC 3:CF(IDE) 4:CF(MEM) 5:SD 6:MMC 7:SPI 8:NX
#define HALK_FMinactType 0x01       // 0:Only one flash 1:NAND 2:SMC 3:CF(IDE) 4:CF(MEM) 5:SD 6:MMC 7:SPI 8:NX
#define HALK_FMSize      0x40       // 64M bytes
#define HALK_FMPageSize  0x01       // 0:256 bytes/page 1:512 bytes/page 2:1024 bytes/page
#endif

#define HAL_DRAM_ZUPDATE_PV 0x00
#define HAL_DRAM_ZUPDATE_PB 0x01
#define HAL_DRAM_ZUPDATE_OSD 0x02
#define HAL_DRAM_ZUPDATE_MPEG 0x03
#define HAL_DRAM_ZUPDATE_ALL 0xFF

//patch4.4@richie@move to DEBUG_PRINTHAL
//#define PRINT_HAL        printf

#define SLASH2 /
#ifdef DEBUG_FRONT
#define PRINT_FRONT printf
#else
#define PRINT_FRONT ;/SLASH2
#endif

#ifdef DEBUG_PRINTHAL
#define PRINT_HAL printf
#else
#define PRINT_HAL ;/SLASH2
#endif

#define VideoCDSPMaxFac 140

/*add by Phil @08.01.02 s*/
typedef enum {
	CAM_MODE_IDLE  = 0x00,
	CAM_MODE_PV    = 0x01,
	CAM_MODE_STILL = 0x02,
	CAM_MODE_VIDEO = 0x03,
	CAM_MODE_PCCAM = 0x04,
	CAM_MODE_PB    = 0x05,
	CAM_MODE_UPDN  = 0x06,
} sp1kCamMode_t;
/*add by Phil @08.01.02 e*/

typedef enum {
	HAL_DRAM_DISP_SRC_PB  = (0 << 0),
	HAL_DRAM_DISP_SRC_MPG = (2 << 0),
} HAL_DramDispSrc_e;

typedef enum {
	HAL_DRAM_ZF_UPD_LAYER_PV  = (1 << 0),
	HAL_DRAM_ZF_UPD_LAYER_PB  = (1 << 1),
	HAL_DRAM_ZF_UPD_LAYER_OSD = (1 << 2),
	HAL_DRAM_ZF_UPD_CLEAR     = 0x00,
} HAL_DramZfUpdSrc_e;

typedef enum {
	LOG_BANK_COM = 0,
	LOG_BANK_0,
	LOG_BANK_1,
	LOG_BANK_2,
	LOG_BANK_3,
	LOG_BANK_4,
	LOG_BANK_5,
	LOG_BANK_6,
	LOG_BANK_7,
	LOG_BANK_8,
	LOG_BANK_9,
	LOG_BANK_10,
	LOG_BANK_11,
	LOG_BANK_12,
	LOG_BANK_13,
	LOG_BANK_14,
	LOG_BANK_MAX,
} logBank_t;

//------------------------------------------------------------------------------
//External Link
//------------------------------------------------------------------------------
//extern  xdata   UINT8   HALG_XXX;

//------------------------------------------------------------------------------
//Function Prototype
//------------------------------------------------------------------------------

// TestMode
#ifdef TestModeEn
UINT8 HAL_TestGlobal(UINT8);
UINT8 HAL_TestSDRAM(UINT8);
UINT8 HAL_TestFront(UINT8);
UINT8 HAL_TestCDSP(UINT8);
UINT8 HAL_TestLCDTV(UINT8);
UINT8 HAL_TestAudio(UINT8);
UINT8 HAL_TestUSB(UINT8);
UINT8 HAL_TestCPU(UINT8);
UINT8 HAL_TestDMAC(UINT8);
UINT8 HAL_TestFlash(UINT8);
UINT8 HAL_TestTVSRAM(UINT8 bank);
UINT8 L3_TestCDSPSRAM(UINT8, UINT8, UINT8, UINT8);
#endif

//Global
UINT8  HAL_Suspend(UINT8);
void   HAL_Resume(void);

UINT8 Hal_ImemShadow(logBank_t Bank, UINT16 Addr);
void Hal_ImemShadowGet(logBank_t *Bank, UINT16 *Addr);
#if 0// 2007.12.05@ suny mark begin
void   HAL_PowerDown(void);
UINT8  HAL_SetModuPowerDown(UINT16);
UINT8  HAL_SetCPUClock(UINT8);
void   HAL_PowerUp(void);
UINT8  HAL_SetModuPowerUp(UINT16);
#endif// 2007.12.05@ suny mark end

#if 0
UINT8  HAL_ConfigGTimer(UINT8);
void   HAL_StartGTimer(void);
void   HAL_StopGTimer(void);
UINT8  HAL_WriteGTimer(UINT32);
#endif
void   HAL_GlobalTimerInit(void);
void   HAL_Read10usGTimer(UINT32*);
void   HAL_ReadGTimer(UINT32*);
UINT8  HAL_10usWait(UINT8);
UINT8  HAL_Wait(UINT32);
UINT8  HAL_DateToBin(PDATE, PDATE);
UINT8  HAL_WriteRTCData(UINT8, UINT8);
UINT8  HAL_WriteRTC(PDATE);
UINT8  HAL_ReadRTCData(UINT8, UINT8*);
UINT8  HAL_BinToDate(PDATE, PDATE);
UINT8  HAL_ReadRTC(PDATE);
#if 1// 2007.12.05@ suny mark begin
UINT8  HAL_WriteAlarm(PDATE);
UINT8  HAL_ReadAlarm(PDATE);
#endif// 2007.12.05@ suny mark end

UINT8 HAL_ConfigPG(UINT8 mode, UINT8 polarity,UINT8 idlstate,UINT16 lowDuty,UINT16 highDuty,UINT8 state);
void HAL_StartPG(UINT8  mode) ;
void HAL_StopPG(UINT8  mode) ;

#if 0// 2007.12.05@ suny mark begin
UINT8  HAL_ConfigUI(UINT8);
void   HAL_WakeUI(void);
UINT8  HAL_WriteUI(UINT16);
UINT8  HAL_ReadUI(UINT8*);
#endif// 2007.12.05@ suny mark end
UINT8 HAL_ReadRegister(UINT16 reg) ;
void HAL_WriteRegister(UINT16 reg ,UINT8 value);
//UINT8  HAL_ConfigGPIOBit(UINT8, UINT8);
//UINT8  HAL_ConfigGPIOByte(UINT8, UINT8);
//UINT8  HAL_SetGPIOBit(UINT8, UINT8);
//UINT8  HAL_SetGPIOByte(UINT8, UINT8);
//UINT8  HAL_GetGPIOBit(UINT8, UINT8*);
//UINT8  HAL_GetGPIOByte(UINT8, UINT8*);
//UINT8  HAL_InitGlobal(UINT8);
//UINT8  HAL_SetTGPll(UINT8);
//void   HAL_ReadRevID(UINT8*);
UINT8  HAL_SetCamMode(sp1kCamMode_t);
void   HAL_GetCamMode(UINT8*);
//UINT8  HAL_WaitVD(UINT8, UINT8);
UINT8   HAL_ReadIOTrap(void);
void  HAL_RTCTransferText(PDATE,UINT8*);     //ada@0220
void  HAL_SuspendResume(void);
void HAL_PwrCtrl(UINT8 cpuclk, UINT8 dramclk, UINT8 reg2013, UINT8 reg2014, UINT8 reg2015);
void HAL_DramClkSet(UINT8 DramClk);
void HAL_BaudRateSet(UINT32 BaudRate);


/* map old hal_gpio api to new ones. */
#define HAL_ConfigGPIOBit(idx, val) \
	HAL_GpioByteDirSet(HAL_GPIO_BYTE_GEN0 + (idx >> 3), 1 << (idx & 0x07), val ? 0xFF : 0x00)
#define HAL_SetGPIOBit(idx, val) \
	HAL_GpioByteOutSet(HAL_GPIO_BYTE_GEN0 + (idx >> 3), 1 << (idx & 0x07), val ? 0xFF : 0x00)
#define HAL_GetGPIOBit(idx, pval) \
	*pval = HAL_GpioByteInGet(HAL_GPIO_BYTE_GEN0 + (idx >> 3), 1 << (idx & 0x07))

//CDSP
UINT8 HAL_InitCDSP(UINT8 CamMode);
UINT8 HAL_DispScaleSet(UINT16 hsize, UINT16 vsize, UINT16 zoomfac);

UINT8  HAL_SetWBGainSet(UINT16 RGain, UINT16 GrGain, UINT16 BGain, UINT16 GbGain);
UINT8 HAL_CdspWBGainGet(UINT8 *RGain, UINT8 *GrGain, UINT8 *BGain, UINT8 *GbGain);
//UINT8  HAL_SetWBOffsetSet(UINT8 wboffseten,UINT8 gosvden, UINT16 ROffset, UINT16 GrOffset, UINT16 BOffset, UINT16 GbOffset,UINT8 wbovalidon);
//UINT8  HAL_SetWBGlobalGainSet(UINT8);
//UINT8 HAL_LenscmpInit(UINT16 *plensdata);
UINT8 HAL_CdspCropSet(UINT8 crop_henable ,UINT8 crop_venable ,UINT8 crop_sync_enable, UINT16 crop_hoffset,UINT16 crop_hsize,UINT16 crop_voffset,UINT16 crop_vsize);
//UINT8 HAL_CdspCropGet(UINT8* crop_henable ,UINT8* crop_venable , UINT16* crop_hoffset,UINT16* crop_hsize,UINT16* crop_voffset,UINT16* crop_vsize);

UINT8 HAL_CdspHscaleRGBEnable(UINT8 hscale_enable, UINT8 hscale_mode,UINT8 hscale_sync_mode);
UINT8 HAL_CdspHscaleRGBSet(UINT8 hscale_enable, UINT8 hscale_mode,UINT8 hscale_sync_mode,UINT16 shsize,UINT16 dhsize);
//UINT8 HAL_CdspGammaInit(UINT8 *pgammadata);
UINT8 HAL_CdspGammaSet(UINT8 enable);
//UINT8 HAL_CdspSpecialeffectSet(UINT8 intlvalidinon);
//UINT8 HAL_CdspIntplCfg(	UINT8 intpllowthr, 	UINT8 Intpledgthr,  UINT8 intplslntthr, UINT8 intplftropt );
UINT8 HAL_CdspIntplmir(UINT8 intplmirhlen,UINT8 intplmirhren,UINT8 intplmirvten,UINT8 intplmirvden,UINT8 intplmirvsel,UINT8 intplcnt2sel);
UINT8 HAL_CdspColorMEn(UINT8 enable);
//UINT8 HAL_CdspColorMSet(UINT16 a00,UINT16 a01,UINT16 a02,UINT16 a10,UINT16 a11,UINT16 a12,UINT16 a20,UINT16 a21,UINT16 a22);
UINT8 HAL_CdspColorMSet_Intr( UINT16 a00, UINT16 a01, UINT16 a02, UINT16 a10, UINT16 a11, UINT16 a12, UINT16 a20, UINT16 a21, UINT16 a22 );
UINT8 HAL_YUV422To444(UINT8 yuvinserten);
//UINT8 HAL_CdspRBClampSet(UINT8 enable,UINT8 RBClampvalue);
UINT8 HAL_CdspBriContSet(UINT8 ybycen,UINT8 ythren,UINT8 uvsathuen,UINT8 yb,UINT8 yc,UINT8 ythr,UINT8 yreven);
void HAL_LensCompCfgEnable(UINT8 stepfator1, UINT8 stepfator2, UINT8 yuvlens,UINT8 chmode);
void HAL_LensCompSizeSet(UINT16 xmoffset,UINT8 Xminc, UINT16 ymoffset , UINT8 Yminc);
void HAL_LensCompCenterSet(UINT16 centx, UINT16 centy);
//UINT8 HAL_CdspHueCorrectionEnable(UINT8 enable  );
//UINT8 HAL_CdspHueCorrectionRSet(UINT16 angleR,  UINT8 n1r, UINT8 n2r ,UINT8 n3r, UINT8 n4r,UINT8 shr,UINT8 ssr );
//UINT8 HAL_CdspHueCorrectionGSet(UINT16 angleG,  UINT8 n1g, UINT8 n2g ,UINT8 n3g, UINT8 n4g,UINT8 shg,UINT8 ssg );
//UINT8 HAL_CDSPBpCompensation(UINT8 badpixen,UINT8 badpixtesten, UINT16* bphitcount ,UINT32 badbaseaddr);
UINT8 HAL_CdspSatHueSet(UINT8 enable,UINT8 uvsat,UINT8 huesin1data,UINT8 huecosdata,UINT8 huesin2data,UINT8 UOffset ,UINT8 VOffset);
UINT8 HAL_CdspVscaleYUVSet(UINT8 syncMode, UINT16 srcSize, UINT16 dstSize);
UINT8 HAL_CdspHscaleYUVSet(UINT8 syncMode, UINT16 srcSize, UINT16 dstSize);
//UINT8 HAL_CdspYUVScaleSyncVD(UINT8 scalesvden,UINT8 scaleszfen);
UINT8 HAL_CdspEdgeUVEnable(UINT8 yedggen,UINT8 ledggen,UINT8 ycoren,UINT8 uvlpfen,UINT8 ybufen);
UINT8 HAL_CdspEdgeMir (UINT8 edgemirhlen,UINT8 edgemirhren,UINT8 edgemirvten,UINT8 edgemirvden);
//UINT8 HAL_CdspEdgeYthrdivset(UINT8 Yhtthr, UINT8 Yhdiv);
//UINT8 HAL_CdspEdgeGainset(UINT8 Gain1, UINT8 Gain2);
//UINT8 HAL_CdspEdgeBwBdset(UINT8 Bw1, UINT8 Bw2,UINT8 Bd1, UINT8 Bd2);
//UINT8 HAL_CdspEdgeFilterset(UINT8 Fr22, UINT8 Fr00,UINT8 Fr01, UINT8 Fr02,UINT8 Fr11, UINT8 Fr12);
UINT8 HAL_CdspAEWinenable(UINT8 AEwinen, UINT8 pAEwinhold,UINT8 AEWintest, UINT8 AEholdsvden);
UINT8 HAL_CdspAEwinfactorset(UINT8 AEhaccfactor, UINT8 AEvaccfactor);
UINT8 HAL_CdspAEwinoffset(UINT16 AEhoffset, UINT16 AEvoffset);
UINT8 HAL_CdspAEwinsizeset(UINT8 AEhsize, UINT8  AEvsize);
UINT8 HAL_CdspAEwinintvlset(UINT8 AEhintvl,UINT8 AEvintvl);
UINT8 HAL_CdspAEwinAddrset(UINT32 AEWinaddr);
UINT8 HAL_ReadAEWindow(UINT8 *AEWin);
UINT8 HAL_CdspAWBWinenable(UINT8 AWBwinen, UINT8 pAWBwinhold,UINT8 AWBWintest, UINT8 AWBwinholdsvd);
UINT8 HAL_CdspAWBWinScaleenable(UINT8 AWBhscaleen, UINT8 AWBvscaleen);
UINT8 HAL_CdspAWBWincfg(UINT16 AWBhstart, UINT16 AWBhend,UINT16 AWBvstart,UINT16 AWBvend,UINT16 AWBhscalefactor,UINT16 AWBvscalefactor);
UINT8 HAL_CdspAWBwinAddrset(UINT32 AWBWinaddr);
//UINT8  HAL_CdspReadDramModeSet(UINT8 Remode,UINT8 Docdsp,UINT8 Darksuben);
UINT8  HAL_CdspReadDramMirrorSet(UINT8 mirrorline,UINT8 Vsmirroren,UINT8 Vemirroren);
UINT8  HAL_CdspReadDramSkippixelSet(UINT8 Skippixel);
UINT8  HAL_CdspReadDramSizeOffsetSet(UINT16 Rhsize,UINT16 Rhoffset,UINT16 Rvsize,UINT16 Rvoffset);
UINT8  HAL_CdspWriteDramMode(UINT8 Mode,UINT8 ModeSVd);
UINT8  HAL_CdspWriteSkip(UINT8 Skip, UINT8 SkipSVd);
UINT8 HAL_CdspWriteSizeClamp(UINT8 HsizeClpEn, UINT16 Hsize, UINT8 VsizeClpEn, UINT16 Vsize, UINT8 SizeSVd);
UINT8  HAL_CdspWriteOffset(UINT16 HOffset, UINT16 VOffset);
UINT8  HAL_CdspImgSource(UINT8 SourceSel);
UINT8 HAL_CdspMaxZFactorSet( UINT16 hfactor, UINT16 vfactor, UINT8 enable);
UINT8  HAL_CdspMaxZFactorGet(UINT16 *hfactor, UINT16 *vfactor, UINT16 bufWidth,  UINT16 bufHeight);
UINT8  HAL_CdspZFactorSet(UINT8  UpdateMode, UINT16 hfactor, UINT16 vfactor, UINT16 bufWidth, UINT16 bufHeight,UINT8  ZUpdateTrigger, UINT16 disfactor );
UINT8 HAL_CdspImgDo(UINT8 mode,UINT16 hoffset,UINT16 dohsize,UINT16 voffset,UINT16 dovsize,UINT8 hmirroren,UINT8 vmirroren,UINT16 dosubwidth,UINT16 dosubheight, UINT16 ScaleFactor);
UINT8 HAL_CdspImgDoABBuf( UINT8 mode, UINT16 hoffset,   UINT16 dohsize,   UINT16 voffset,   UINT16 dovsize,UINT8  hmirroren,UINT8  vmirroren, UINT16 writeOffset );
UINT8 halCdspVScaleDoABBuf( UINT8 mode, UINT16 hoffset, UINT16 dohsize, UINT16 voffset, UINT16 dovsize, UINT8 hmirroren, UINT8 vmirroren, UINT16 hfactor, UINT16 vfactor, UINT16 hfactini, UINT16 vfactini, UINT16 calrealdo, UINT16 writeVOffset );
UINT8 HAL_CdspImgVDoC_Scale(UINT8 mode,UINT16 hoffset,UINT16 dohsize,UINT16 voffset,UINT16 dovsize,UINT8 hmirroren,UINT8 vmirroren,UINT16 dosubwidth, UINT16 calrealdo, UINT16 tghsize,UINT16 tgvsize);
UINT8 HAL_CarryWork( UINT32 *tmpvini, UINT16 *vrealdo, UINT16 dovsize, UINT16 vfactor );
UINT8 HAL_CDSPeofWait( UINT8 Number );
//UINT8 halCdspDoYuvHScaling( UINT16 srcXSize, UINT16 srcYSize, UINT16 dstXSize, UINT16 dstYSize );
void SpecailEffect_ContrastSet( void );
void SpecailEffect_BlackWhite( void );
void SpecailEffect_Cold( void );
void SpecailEffect_Warm( void );
void SpecailEffect_Sunset( void );
void SpecailEffect_Sepia( void );
void SpecailEffect_Negtive( void );
void SpecailEffect_Binarize( void );
void SpecailEffect_Red( void );
void SpecailEffect_Blue( void );
void SpecailEffect_Green( void );
void SpecailEffect_Normal( void );
static void halCdspEffectSaveYuvNormal( void );
static void halCdspEffectRestoreYuvNormal( void );
void halCdspSubSizeCal( UINT8 mode, UINT32 vrmder, UINT16 *hSize, UINT16 *hSub, UINT16 *vSub );
void halCdspRegBackup( void );

//Flow 9
UINT8 HAL_AWBWindowSizeSet(UINT16 AWBhstart,UINT16 AWBhend,UINT16 AWBvstart,UINT16 AWBvend, UINT8 WinSize);

#if 0 // hlc 0318 add, start
void AEWinInit();
void sp1kAWBConfig();
#endif // hlc 0318 add, end

//void HAL_StillWB(	UINT32 rawBufAddr,	UINT16 rawXSize,	UINT16 rawYSize);
//void AFTest();
void awbDefaultProc(void);
void awbDefaultProc_Video(void);
void awbDefaultProc_PostWB( void );
void aeDefaultProc(void);
UINT8 HAL_AWBWindowRead1024(void);
void alcCal_Intr(void);
//UINT8 HAL_AWBWindowRead256(void);

////NEWAWB
#if 0
typedef UINT32 raw_pixel_t;
typedef UINT32 raw_gain_t;
typedef UINT16 pixel_cnt_t;
#define UNITY_GAIN	((raw_gain_t)1024)
#else
typedef UINT8 raw_pixel_t;
typedef UINT16 raw_gain_t; /* allow for raw_pixel_t*UNITY_GAIN */
typedef UINT8 pixel_cnt_t; /* 255 sampling max */
#define UNITY_GAIN	((raw_gain_t)256)
#endif
UINT8 awbWhitePointFilter(raw_pixel_t	R,raw_pixel_t	G,raw_pixel_t	B	);
void awbRBGainDecider(void);
void awbThresholdInit(UINT8 mode);
void awbCalConvergeGain(void);

#if 0
static SINT32 Slop_Calculator(	UINT16	start_x,	UINT16	start_y,	UINT16	end_x,	UINT16	end_y	);
#else
static UINT16 Slop_Calculator(	UINT16	start_x,	UINT16	start_y,	UINT16	end_x,	UINT16	end_y	);
static UINT8 Slop_filter(	UINT16	start_x,	UINT16	start_y,	UINT16	end_x,	UINT16	end_y,	UINT16	slop);
#endif
void SpecailEffect_ContrastSet( void );
void SpecailEffect_BlackWhite( void );
void SpecailEffect_Cold( void );
void SpecailEffect_Warm( void );
void SpecailEffect_Sunset( void );
void SpecailEffect_Sepia( void );
void SpecailEffect_Negtive( void );
void SpecailEffect_Binarize( void );
void SpecailEffect_Red( void );
void SpecailEffect_Blue( void );
void SpecailEffect_Green( void );
void SpecailEffect_Normal( void );

UINT8 HAL_CdspImgSnapDo_Scale( UINT8 mode, UINT16 dohsize,  UINT16 dovsize, UINT8 hmirroren, UINT8 vmirroren,  UINT16 tghsize, UINT16 tgvsize, UINT16 hFactor, UINT16 vFactor);

UINT8 halCdspWBGainSet( UINT8 enable );
UINT8 halCdspWBGainGet( void );
UINT8 halCdspWBOffsetSet( UINT8 enable );
UINT8 halCdspWBOffsetGet( void );
UINT8 halCdspGammaSet( UINT8 enable );
UINT8 halCdspGammaGet( void );
//UINT8 halCdspLCEnableSet( UINT8 enable );
UINT8 halCdspLCEnableGet( void );

//-----------------------------------------------------------------------------------------

//AUDIO
UINT8 HAL_InitAudio(UINT32 CamMode);
UINT8 HAL_InitAC97(void);
UINT8 HAL_RdAC97Reg(UINT8 AC97Addr, UINT16* Value);
UINT8 HAL_WrAC97Reg(UINT8 AC97Addr, UINT16 Value);
UINT8 HAL_InitEmbAudCodec(BIT Play);
UINT8 HAL_SetEmbAudCodecVol(UINT8 Volume);
UINT8 HAL_EnableAudStream(UINT8 AudFormat, UINT8 ADCFreq);
UINT8 HAL_PlayAud(UINT32 DRAMAddr, UINT8 AudBufSize, UINT8 AudFormat, UINT8 PlayFreq );
UINT8 HAL_RecordAud(UINT32 DRAMAddr, UINT8 AudBufSize, UINT8 AudFormat);
UINT8 HAL_RecordAudDMAMode(UINT8 AudFormat);
UINT8 HAL_StopAud(void);
void HAL_AudPause( void );
void HAL_AudResume( void );
void HAL_AudVolumeSet( UINT8 volnum, UINT8 voldenum );
UINT8 HAL_RecordAudToDRAM(UINT32 DRAMAddr, UINT8 AudBufSize, UINT8 AudFormat);
UINT8 HAL_PlayAudFromDRAM(UINT32 DRAMAddr, UINT8 AudBufSize, UINT8 AudFormat, UINT8 PlayFreq );
UINT8 HAL_PlayAudDMAMode(UINT32 DRAMAddr, UINT8 AudFormat, UINT8 PlayFreq );
UINT8 HAL_ReadDRAMAudBufCnt(UINT32 *pDRAMAudBufCnt);
UINT8 HAL_ReadAudBufCnt(UINT32 *pAudBufCnt);
UINT8 HAL_SetDRAMAudDMACnt(UINT8 Enable);
void halAudAgcStatGet( UINT32 *eng, UINT32 *window, UINT8 *cnt );
void halAudPGAGainSet( UINT32 gain, UINT32 boost );
void halAudPGAGainGet( UINT32 *gain, UINT32 *boost );
void halAudAgcWindowSet( UINT16 window );

// temp
UINT8 HAL_InitPWM(void);
//void HAL_AudReset( void );
void HAL_AudStart( UINT32 mode, UINT32 samplingRate, UINT32 sampleBit, UINT32 channel );
void HAL_SoundPlayTrg(void);
void HAL_SoundPlayCfg(UINT32 sampleRate,UINT32 sampleBit,UINT32 channel);
//UINT32 hwAudRecord( UINT32 sdramAddr, UINT32 samplingRate, UINT32 audFormat, UINT32 rectime,	UINT32 adpcmenc, UINT32 blockSize );
void HAL_AudThdSet( UINT32 thd );
UINT8 HAL_AudIntStsGet( UINT16 mode );
void HAL_AudRingBufferSet( UINT32 sdramAddr, UINT32 sizeByte );
void HAL_AudInIndexSet( UINT32 index );
void HAL_AudInIndexGet( UINT32 *index );
void HAL_AudOutIndexSet( UINT32 index );
void HAL_AudOutIndexGet( UINT32 *index );
void HAL_AudAdpcmSet( UINT32 mode, UINT32 on, UINT32 blockSize, UINT32 skipSize );
UINT8 HAL_ReadAudRingBufCnt(UINT32 mode, UINT32 *pAudBufCnt);
//void HAL_AudPlayStop( void );
void HAL_AudStop( UINT32 mode );

//DRAM
//UINT8 HAL_InitSDRAM(UINT8);
void  HAL_DRAMDMA(UINT32 srcbyteaddr, UINT32 dtnbyteaddr, UINT32 bytesize, UINT8 wait);
//void  HAL_DRAMindirectwrite(UINT32 wordaddr, UINT16 worddata);
//void  HAL_DRAMindirectread(UINT32 wordaddr, UINT16* worddata);
UINT8 HAL_DRAMSetStartAddr(UINT32, UINT8);
UINT8 HAL_DRAMReadWord(UINT8 *, UINT8 *);
UINT8 HAL_DRAMWriteWord(UINT8, UINT8);
void halDramDispSrcSel(UINT8 srcSel);
UINT8 HAL_DramDispSrcGet(void);

//UINT8 HAL_DRAMReadWord(UINT32, UINT8 *, UINT8 *);
//UINT8 HAL_DRAMWriteWord(UINT32, UINT8, UINT8);
UINT8 HAL_FillDRAM(UINT32, UINT16, UINT8, UINT8);
UINT8 HAL_FillLongDRAM(UINT32 DRAMAddr, UINT32 FillSize, UINT8 LowByteData, UINT8 HighByteData);
UINT8 HAL_SetJPEGVscale(UINT16, UINT16);
//UINT8 HAL_WriteQTable(UINT8, UINT8, UINT8*);
//UINT8 HAL_ReadQTable(UINT8, UINT8 *, UINT8 *);
//UINT8 HAL_Compress(UINT32, UINT32, UINT32, UINT8, UINT8);
//UINT8 HAL_DeCompress(UINT32, UINT16, UINT16, UINT32, UINT8, UINT8, UINT16);
//UINT8 HAL_AutoCompress(UINT32 VLCAAddr, UINT32 VLCBAddr, UINT8 Option);
//void HAL_VlcBoundSet( UINT16 enable, UINT32 size );
//void HAL_MjpgClipAbort(void);
//UINT8 HAL_ReadCompSize(UINT32*);
//UINT8 HAL_JpgZFactorSet( UINT16 hfactor, UINT16 vfactor, UINT16 SrcWidth, UINT16 SrcHeight, UINT16 DstWidth, UINT16 DstHeight, UINT8 option );
//UINT8 HAL_JpgROISet( UINT8 option, UINT16 SrcHsize, UINT16 SrcVsize, UINT16 SrcOffsetX, UINT16 SrcOffsetY, UINT16 DetHsize, UINT16 DetVsize, UINT8 rot );
//UINT8 HAL_CheckDecompress(void);
UINT8 HAL_SetAFBAddr(UINT32);
UINT8 HAL_SetBFBAddr(UINT32);
UINT8 HAL_SetCFBAddr(UINT32 CFBAddr);
UINT8 HAL_SetDFBAddr(UINT32 DFBAddr);
UINT8 HAL_SetAFBSize(UINT16, UINT16);
void  HAL_DRAMPreviewStart(UINT8 pbFreeze);
UINT8 HAL_SetRFBSize(UINT16, UINT16);
UINT8 HAL_SetAVLCAddr(UINT32);
UINT8 HAL_SetBVLCAddr(UINT32);
UINT8 HAL_SetDoYuvSrcHSize( UINT16 size );
//UINT8 HAL_SetDCTAddr(UINT32);
//UINT8 HAL_SetAUDAddr(UINT32);
//UINT8 HAL_SetFOSDAddr(UINT32);
UINT8 HAL_SetRFBAddr(UINT32);
//UINT8 HAL_SetACDSPWidth(UINT16);
//UINT8 HAL_SetBCDSPWidth(UINT16);
//UINT8 HAL_SetRCDSPWidth(UINT16);
//UINT8 HAL_SetImageType(UINT8);
//UINT8 HAL_SetDisplayMode(UINT8, UINT8);
UINT8 HAL_ClrVLCRdy(UINT8);
//UINT8 HAL_SelDRAMRefreshSrc(UINT8);
//UINT8 HAL_EnterExitSelfRefresh(UINT8);
//UINT8 HAL_SetAGBAddr(UINT32);
//UINT8 HAL_SetBGBAddr(UINT32);
//UINT8 HAL_SetAGBSize(UINT16, UINT16);
//UINT8 HAL_SetBGBSize(UINT16, UINT16);
//UINT8 HAL_DoDRAMDMA(UINT32, UINT32, UINT32);
void HAL_ZUpdateWait(UINT8, UINT32 timeout);

//patch5.0@richie@sdram mapping begin
//UINT8 HAL_ScaleUpImage(UINT32, UINT16, UINT16, UINT32, UINT16, UINT16, UINT32);
//UINT8 HAL_ScaleUpImage_H(UINT32 SrcAddr, UINT16 SrcHsize, UINT16 SrcVsize, UINT32 DstAddr, UINT16 DstHsize);
//UINT8 HAL_ScaleUpImage_V(UINT32 SrcAddr, UINT16 SrcHsize, UINT16 SrcVsize ,UINT32 DstAddr, UINT16 DstVsize);
//UINT8 HAL_ScaleDownImage(UINT32, UINT16, UINT16, UINT32, UINT16, UINT16, UINT32);
//UINT8 HAL_ScaleDownImage_H(UINT32 SrcAddr, UINT16 SrcHsize, UINT16 SrcVsize,UINT32 DstAddr, UINT16 DstHsize);
//UINT8 HAL_ScaleDownImage_V(UINT32 SrcAddr, UINT16 SrcHsize, UINT16 SrcVsize, UINT32 DstAddr,UINT16 DstVsize);
//patch5.0@richie@sdram mapping end
#if 1
void HAL_copy(UINT32  srcaddr, UINT16 srchsize, UINT16 srcvsize, UINT16 srchoft, UINT16 srcvoft,
             UINT32  dtnaddr, UINT16 dtnhsize, UINT16 dtnvsize, UINT16 dtnhoft, UINT16 dtnvoft,
             UINT16 cphsize, UINT16 cpvsize,  UINT16 pastethd, UINT8 wait);
UINT8 HAL_copy_Intr(UINT32  srcaddr, UINT16 srchsize, UINT16 srcvsize, UINT16 srchoft, UINT16 srcvoft,
             UINT32  dtnaddr, UINT16 dtnhsize, UINT16 dtnvsize, UINT16 dtnhoft, UINT16 dtnvoft,
             UINT16 cphsize, UINT16 cpvsize,  UINT16 pastethd, UINT8 wait);
void HAL_gprmscale(UINT32 srcaddr, UINT16 srchsize, UINT16 srcvsize,
                  UINT32 dtnaddr, UINT16 dtnhsize, UINT16 dtnvsize, UINT32 tmpaddr, UINT8 wait);
void HAL_gprmscaleVFactor(UINT32 srcaddr, UINT16 srchsize, UINT16 srcvsize,
				  UINT32 dtnaddr, UINT16 dtnhsize, UINT16 dtnvsize, UINT32 tmpaddr, UINT16 vSF, UINT16 vISF, UINT8 wait);
void HAL_gprmrot(UINT8 mode, UINT32 srcaddr, UINT32 dtnaddr, UINT16 srchsize, UINT16 srcvsize, UINT8 wait);
UINT8 HAL_gprmrot_Intr(UINT8 mode, UINT32 srcaddr, UINT32 dtnaddr, UINT16 srchsize, UINT16 srcvsize);
void HAL_DRAMbpcfg(UINT32 bufaddr, UINT16 hsize, UINT16 vsize) ;
void HAL_DRAMbpfix(UINT16 badpixthd, UINT16 bphoft, UINT16 bpvoft, UINT8 wait);
void HAL_scadnh(UINT32 srcaddr, UINT16 srchsize,
               UINT32 dtnaddr, UINT16 dtnhsize, UINT16 vsize, UINT8 wait) ;
void HAL_scadnv(UINT32 srcaddr, UINT16 srcvsize,
               UINT32 dtnaddr, UINT16 dtnvsize, UINT16 hsize, UINT8 wait);
void HAL_scauph(UINT32 srcaddr, UINT16 srchsize,
               UINT32 dtnaddr, UINT16 dtnhsize, UINT16 vsize, UINT8 wait);
void HAL_scaupv(UINT32 srcaddr, UINT16 srcvsize,
               UINT32 dtnaddr, UINT16 dtnvsize, UINT16 hsize, UINT8 wait);
//void HAL_scauph_test(UINT32 srcaddr, UINT16 srchsize, UINT32 dtnaddr, UINT16 dtnhsize, UINT16 vsize, UINT16 vSF, UINT16 vISF, UINT8 wait);
void HAL_scaupVFactor(UINT32 srcaddr, UINT16 srcvsize, UINT32 dtnaddr, UINT16 dtnvsize, UINT16 hsize, UINT16 vSF, UINT16 vISF, UINT8 wait);
void HAL_scadnVFactor(UINT32 srcaddr, UINT16 srcvsize, UINT32 dtnaddr, UINT16 dtnvsize, UINT16 hsize, UINT16 vSF, UINT16 vISF, UINT8 wait);

#endif
//UINT8 HAL_SetFixBadPxlThd(UINT8);
//UINT8 HAL_FixOneBadPixel(UINT16, UINT16);
//UINT8 HAL_SetStampFontColor(UINT8, UINT8, UINT8);
//UINT8 HAL_SetStampFontScale(UINT8);
//UINT8 HAL_StampOneFont(UINT32, UINT32, UINT16, UINT16, UINT32);
//UINT8 HAL_RotateImage(UINT32, UINT16, UINT16, UINT32, BIT);
//UINT8 HAL_TransYUV420toYUV422(UINT32, UINT16, UINT16);
//UINT8 HAL_CopyImage(UINT32, UINT16, UINT16, UINT16, UINT16, UINT16, UINT16, UINT32, UINT16, UINT16, UINT16, UINT16);
//UINT8 HAL_SetCopyColorKey(BIT, UINT8);
//UINT8 HAL_SubDarkFrame(UINT32, UINT32, UINT16, UINT16);
//UINT8 HAL_ChkDRAMImgRdy(void);
//UINT8 HAL_CheckDRAMStatus(void);
//UINT8 HAL_SetCapint(UINT8);
void  HAL_DRAMsizetest(void);

UINT8 Hal_RomShadowToDram(void);
UINT8 Hal_DramShadowToImem(void);
UINT8 HAL_SkipWrite2Dram(void);

void HAL_DramZfUpdTrig(UINT8 layer);

//LCDTV
UINT8 HAL_InitLCDTV(UINT8 CamMode);
UINT8 HAL_SetDisplaySrcImgSize(UINT16 hsize, UINT16 vsize, UINT8 type);
UINT8 HAL_DefineColorKey(UINT8 attrib);
void HAL_DispRegUpdate(void);

//FRONT
UINT8 HAL_InitFront(UINT8 CamMode);
UINT8 HAL_SSCConfig (UINT8 SlaveAddr, UINT8 Frequency);
UINT8 HAL_WriteSSC (UINT8 *RegAddr, UINT8 *RegData, UINT8 Count, UINT8 Option);
UINT8 HAL_WriteSSC_Intr (UINT8 *RegAddr, UINT8 *RegData, UINT8 Count, UINT8 Option);
UINT8 HAL_ReadSSC(UINT8 RegAddr, UINT8 *RegData, UINT8 Count, UINT8 Option);
UINT8 HAL_SetFrontTGEn(UINT16 LineTotal, UINT16 LineBlank, UINT16 FrameTotal, UINT16 FrameBlank, UINT8 SyncMode, UINT8 TGEn);
UINT8 HAL_SetFrontYUVEn(UINT8 UVSel, UINT8 YSub128en, UINT8 USub128en, UINT8 VSub128en, UINT8 Bt656en, UINT8 YUVen);
UINT8 HAL_SetFrontYUVEn(UINT8 UVSel,UINT8 YSub128en,UINT8 USub128en,
	UINT8 VSub128en,UINT8 Bt656en,UINT8 YUVen);
UINT8 HAL_SetFrontInverse(UINT8 Hinverse, UINT8 Vinverse);
UINT8 HAL_SetFrontImgCrop(UINT16 HOffset, UINT16 VOffset, UINT16 HSize, UINT16 VSize, UINT8 CropMode);
UINT8 HAL_SetFrontReshape(UINT16 HFall, UINT16 HRise, UINT8 HReshen, UINT16 VFall, UINT16 VRise, UINT8 VReshen);
UINT8 HAL_SetFrontIOConfig(UINT8 TGGPIOSel, UINT8 TGInputGate, UINT8 TGGPIOen, UINT8 TGGPIOVal);
UINT8 HAL_SetFrontCLKSet(UINT8 MasterClkDiv, UINT8 PixelClkDiv, UINT8 SyncMode);
UINT8 HAL_SetFrontCLKSource(UINT8 MasterClkSrc, UINT8 PixelClkSrc);
UINT8 HAL_SetFrontInterrupten(UINT16 Enable);
UINT8 HAL_ClrFrontInterrupt(UINT16 Clear);
UINT8 HAL_FrontInterruptCfg(UINT8 VdRintNum, UINT8 VdFintNum, UINT16 IntHNum0, UINT16 IntHNum1, UINT16 IntHNum2, UINT16 IntHNum3);

UINT8 HAL_FrontInputGate( UINT8 tggz );
void  HAL_FrontSnapSet(UINT16 Hsize,UINT16 Vsize) ;
void  HAL_FrontInit (UINT8 CamMode);
void  HAL_FrontPreviewSet(void);
void  HAL_SensorInit (void);
void  HAL_SensorRegInit(void);
UINT8 HAL_FrontGainSet( UINT32 value, UINT32  option);
UINT8 HAL_FrontGainSet_Intr( UINT32 value, UINT32  option);
UINT32 HAL_FrontExpTimeSet(UINT32 value,	UINT32 option);
UINT32 HAL_FrontExpTimeSet_Intr(UINT32 value,	UINT32 option);
UINT32 HAL_FrontFrameRateSet( UINT32 value, UINT32 option);
UINT32 HAL_FrontFrameRateSet_1( UINT32 value, UINT32 option);
void  HAL_FrontIntrEnable(UINT32 enable, UINT8 value);

UINT8 HAL_SnapFront(UINT8 SnapNum);
UINT8 HAL_SetFrameRate (UINT8 FrameRate, UINT8 Option);
UINT8 HAL_SetExposureTime (UINT32  Number, UINT8 Option);
UINT8 HAL_AdjustGain(UINT16 Value, UINT8 Option);
UINT8 HAL_FrontVdWait(UINT8 Type,UINT8 Number);
UINT8 HAL_FrontVvalidWait(UINT8 Type, UINT8 Number);

void  HAL_SuspendFront(void);
void  HAL_SetSensorPreview(void);
UINT8 HAL_SnapRaw8(UINT8 mode, UINT8 opt);
void HalSensorPrePV( void );

//CPU
#if 0
UINT8 HAL_InitCPU(UINT8);
#endif
UINT8 HAL_Set4KSRAMMode(UINT8);
#if 0
UINT8 HAL_4KSRAMBufIdx(UINT8, UINT16, UINT16*, UINT16*);
void  HAL_Write4KSRAMPort(UINT8);
void  HAL_Read4KSRAMPort(UINT8*);
#endif
UINT8 HAL_DownloadROM(UINT16, UINT32, UINT16);
void  HAL_Int0(void);
void  HAL_EnterInterrupt(void);
void  HAL_LeaveInterrupt(void);
void  HAL_DisableInterrupt(void);
void  HAL_EnableInterrupt(void);
void  HAL_CtlInOutEnable(void);

//DMA
UINT8 HAL_NandDMACheck(void);
UINT8 HAL_DoNandDMA(UINT8 , UINT16 );
UINT8 HAL_DoDMA(UINT8, UINT8, UINT16, UINT8, UINT8);
void  HAL_ResetDMA(void);
void  HAL_GetDMABufSize(UINT8*);
void  HAL_WriteDMAPort(UINT8);
void  HAL_ReadDMAPort(UINT8*);
void  HAL_CheckDMACmp(UINT8*);
UINT8 HAL_SetDRAMDMA(UINT32);
UINT8 HAL_SetSRAMDMA(UINT16);
//UINT8 HAL_SetUSBDMA(UINT8, UINT8);
UINT8 HAL_SetAudDMA(UINT8 );
void  HAL_ReadDRAMDMAAdr(UINT32* );
//UINT8 HAL_SearchPattern(UINT32, UINT8, UINT8, UINT16, UINT16*, UINT16*);

//FLASH
UINT8 HAL_FlashMode(UINT8, UINT8, UINT8);
UINT8 HAL_ReadECC(UINT8, UINT8*);
void HAL_ClearECC(void);
void HAL_ECCMode(UINT8);

//NAND
UINT8 HAL_NANDInit(UINT8 , UINT8);
UINT8 HAL_NANDSendCmd(UINT8);
UINT8 HAL_NANDSendAddr(UINT8,UINT32);
void  HAL_NANDCheckRdy(UINT8*);
void  HAL_NANDWritePort(UINT8);
UINT8 HAL_NANDReadPort(void);
void  HAL_NANDCompleteOperation(void);
void HAL_NANDEnableWriteProtect(void);
/*Phil add new MTD driver s*/
UINT8 HAL_NANDChkRdy(void);
UINT8 HAL_NANDAutoCmdCfg(UINT8 xdata* pCmd, UINT8 CmdCnt, UINT8 xdata* pAddr, UINT8 AddrCnt);
void HAL_NANDSetDRAMDMA(UINT32 DRAMAddr);
void HAL_NANDDoDMACfg(UINT8 Src,UINT8 Dst, UINT16 nByte, UINT8 FlashPageDMA);
UINT8 HAL_NANDDoDMAWait(void);
/*Phil add new MTD driver e*/
// SD
#if (SD)
//UINT8 HAL_SDCardDetect(UINT8*);     //ada@0218
void HAL_SDInit(UINT8);
void HAL_SDConfig(UINT8 ,UINT8 ,UINT8);
void HAL_SDReset(void);
void HAL_SDBlockSize(UINT16 );

UINT8 HAL_SDTxCommand(unsigned char, unsigned long, unsigned char, UINT8*);

void HAL_SDReadRspBuf(UINT8 , UINT8* );
void HAL_SDRspBufState(UINT8* );
void HAL_SDDataBufState(UINT8* );
void HAL_SDReadCRC7(UINT8* );
void HAL_SDCardCRCStat(UINT8* );
//void HAL_SDTimeOut(UINT8* );
void HAL_SDTxData(void);
void HAL_SDRxData(void);
void HAL_SDRxCRC(void);
unsigned char HAL_SDTxDummy(void);

//patch4.5@ada@Add timeout count begin
UINT8 HAL_SDWaitIdle(void);
//void HAL_SDWaitIdle(void);
//patch4.5@ada@Add timeout count end

UINT8 HAL_SDCheckDat0(void);
void HAL_SDReadPort(UINT8* );
void HAL_SDWritePort(UINT8 );
UINT8 sdSectorW(UINT32 start, UINT32 num, UINT32 SrcAddr);
UINT8 sdSectorR(UINT32 start, UINT32 num, UINT32 TarAddr);
#define	SD_TIME_OUT	(XBYTE[0x2453] & (1<<6))
#define	SD_CRC16_OK	!(XBYTE[0x2400] & 0x08)//(XBYTE[0x245F])
#endif

//USB
UINT8 HAL_BulkInOut(void);
UINT8 HAL_BulkOutToDRAM(UINT32 DRAMAddr, UINT16 nByte);
UINT8 HAL_BulkInFromDRAM(UINT32 DRAMAddr, UINT16 nByte);
//UINT8 HAL_InitUSB (UINT8);
void HAL_USBSwPlugOut(void);
void HAL_USBSwPlugOut_Intr(void);
void HAL_USBSwPlugIn(void);
void HAL_USBPccamInit(void);
void HAL_USBMjpgQTableWrite(void);
UINT8 HAL_USBAutoCompress(UINT32 VLCAAddr, UINT32 VLCBAddr, UINT8 Option);
UINT8 HAL_UsbBulkEnable(UINT8 BulkDir);
void HAL_USBForceFS(void);
UINT8 HAL_UsbParaSet(UINT8 selector,UINT8 value);


//AE,AWB
void HAL_SnapTest(void);
void HAL_SnapFlow(void);

//richie@ae0226
UINT8 HAL_InitAEAW(UINT8 CamMode);

//richie@ae0226
//For Custom
//UINT8 HAL_InitCustom(UINT8 CamMode);
UINT8 L3_FindAFHome() ;

//UINT8 HAL_AdcGPIOConfig(UINT8 index, UINT8 intEn, UINT16 sarClk);
//UINT8 HAL_AdcGPIOGet(UINT8 index, UINT16* value);

void halCdspBayerPatternSet(UINT8 ptn);

#endif  /* __HAL_H__ */

